#include <proxy_pattern.h>
#include <iostream>

RealImage::RealImage(string fileName)
{
    this->fileName = fileName;
    this->loadFromDisk(fileName);
}

void RealImage::display()
{
    cout << "Displaying " << this->fileName << endl;
}

void RealImage::loadFromDisk(string fileName)
{
    cout << "Loading " << fileName << endl;
}

ProxyImage::ProxyImage(string fileName)
{
    this->fileName = fileName;
}

void ProxyImage::display()
{
    if(this->realImage == nullptr)
    {
        this->realImage = new RealImage(this->fileName);
    }
    this->realImage->display();
}
